package com.library.lockConsumer.user;

import com.library.lockProvider.pojo.boxAndCabinet.BoxAndCabinet;
import com.library.lockProvider.pojo.boxAndCabinet.BoxAndCabinetResult;
import com.library.lockProvider.service.BoxAndCabinetService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Date;

@Controller
@RequestMapping("/BoxAndCabinetController")
public class BoxAndCabinetController {
    @Autowired
    BoxAndCabinetService boxAndCabinetService;

    @GetMapping("/findMyBox")
    @ResponseBody
    public BoxAndCabinetResult boxAndCabinetService(String s_id){
        return boxAndCabinetService.findBoxByS_id(s_id);
    }

    @GetMapping("/appointBox")
    @ResponseBody
    public int appointBoxBySpare(String s_id){
        //System.out.println(startTime+" "+endTime);
        return boxAndCabinetService.appointBoxBySpare(s_id);
    }

    @GetMapping("/cancelBox")
    @ResponseBody
    public int cancelBox(String s_id){
        return boxAndCabinetService.cancelBox(s_id);
    }


}
